package com.kg.fiber.domain;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.google.common.collect.Lists;
import com.ivan.toolkit.common.Configs;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement
@NoArgsConstructor
public class AppConfig {
	
	public static Configs.Instance<AppConfig> instance = 
			new Configs.Instance<AppConfig>(AppConfig.class, true);

	
	@XmlElement
	@Setter @Getter
	private List<NetNode> nodes = Lists.newLinkedList();
	
	public NetNode findNode(String host) {
		for(NetNode node : nodes) {
			if(node.getHost().equals(host))
				return node;
		}
		return null;
	}

}
